package com.letv.whatslive.model.dto;

import com.google.common.collect.Maps;
import com.letv.whatslive.model.Start_ImageSrc;
import com.letv.whatslive.model.constant.ActivityConstants;
import com.letv.whatslive.model.constant.ProgramConstants;
import lombok.Getter;
import lombok.Setter;

import java.util.Map;

/**
 * Created by gaoshan on 15-10-23.
 */
@Setter
@Getter
public class StartVarDTO {

    private Long startTime;
    private Long endTime;
    private Long showSeconds;
    private String pic;
    private Long updateTime;
    private String url;
    private Integer type;// 0,H5页面  1,观看直播页  2,观看录播页  3,活动页
    private Map property;

    // 1,观看直播页或录播页
    public static final Integer LIVE_REPLAY_PAGE = 1;
    // 3,活动页
    public static final Integer ACTIVITY_PAGE = 3;

    public StartVarDTO() {

    }

    public StartVarDTO(boolean isDefault) {
        this.setStartTime(1445601865077L);
        this.setEndTime(1447701865077L);
        this.setShowSeconds(3L);
        this.setPic("http://g3.letv.cn/vod/v1/MTE2LzMyLzQ1L2xldHYtaXR2Mi8wL3N0YXRpY2ZpbGUvaW1ncy8yMDE1MDMwMy9mODhiNGExYzMzOWQ3ZDUyNzQ3YjIwYThmNzlmMzFmZC5qcGc=?b=123456&platid=5&splatid=500");
        this.setUpdateTime(1445601865078L);
    }

    public StartVarDTO(String pic) {
        this.setStartTime(1445601865077L);
        this.setEndTime(1447343999000L);
        this.setShowSeconds(3L);
        this.setPic(pic);
        this.setUpdateTime(1447311600000L);
    }

    public StartVarDTO(Start_ImageSrc startImageSrc) {

        this.setStartTime(startImageSrc.getStartTime());
        this.setEndTime(startImageSrc.getEndTime());
        this.setShowSeconds(startImageSrc.getShowTime());
        this.setPic(startImageSrc.getPicUrl());
        this.setUpdateTime(startImageSrc.getUpdateTime());
        this.setUrl(startImageSrc.getAdUrl());
        this.setType(startImageSrc.getType());
        if (startImageSrc.getType().equals(LIVE_REPLAY_PAGE)) {
            Map propertyMap = Maps.newHashMap();
            propertyMap.put("id", startImageSrc.getBusiId());
            this.setProperty(propertyMap);
            this.setUrl(ProgramConstants.SHARE_URL + startImageSrc.getBusiId());
        }
        if (startImageSrc.getType().equals(ACTIVITY_PAGE)) {
            Map propertyMap = Maps.newHashMap();
            propertyMap.put("actId", startImageSrc.getBusiId());
            this.setProperty(propertyMap);
            this.setUrl(ActivityConstants.ACTIVITY_SHARE_URL + startImageSrc.getBusiId());
        }
    }

    public StartVarDTO(Long updateTime) {

        this.setStartTime(0L);
        this.setEndTime(0L);
        this.setShowSeconds(0L);
        this.setPic("");
        this.setUpdateTime(updateTime);
        this.setUrl("");

    }
}
